package com.anywide.listener;
import java.sql.SQLException;

import javax.naming.NamingException;

import com.anywide.dawdler.core.annotation.RemoteService;
import com.anywide.dawdler.server.context.DawdlerContext;
import com.anywide.dawdler.server.listener.DawdlerServiceListener;
import com.anywide.dawdler.serverplug.transaction.LocalConnectionFacotry;
import com.anywide.service.user.UserService;

/**
* 
* @ClassName: ListenerOne 
* @Description: TODO
* @author jackson.song
* @date 2018年10月20日 下午11:20:12 
*
 */

public class ListenerOne implements DawdlerServiceListener{
	@RemoteService
	UserService userRemote;
	@Override
	public void contextDestroyed(DawdlerContext dawdlerContext) {
	}

	@Override
	public void contextInitialized(DawdlerContext dawdlerContext) {
//		System.out.println(Thread.currentThread().getContextClassLoader());
//		System.out.println(userRemote.getClass());
//		
//		try {
//			System.out.println(userRemote.selectUser());
//		} catch (SQLException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		System.out.println("demo完。。。。");
//		Properties props = new Properties();
//		 props.setProperty("java.naming.factory.initial",
//		 javaURLContextFactory.class.getName());
	try {
		System.out.println(LocalConnectionFacotry.getDataSourceInDawdler("read1").getConnection());
	} catch (NamingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	}
}

